home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util1 / xpkatn10.lha / XPKatana / Arexx / Pack_kat.rexx < prev    next >
OS/2 REXX Batch file  |  1995-12-26  |  2KB  |  98 lines

  1. /*************************************************************************
  2.  Pack_kat.rexx  0.1 (26.12.95) by Eric Sauvageau
  3.  
  4.  Script for XPkatana - Will pack the specified file with the (optional) 
  5.    specified packer.  Specifying "?" as the source file will open a file
  6.    requester, asking for the source.
  7.  
  8.  Usage: Pack_kat.rexx <filename> [packer]
  9.  
  10. **************************************************************************/
  11.  
  12.  
  13. /*** We want ANSWERS!!! :) ***/
  14. Options results
  15.  
  16. /*** 
  17.      We need to get the shell's path, so XPKatana will be able to
  18.      locate the desired source file if XPKatana can't locate it.
  19. ***/
  20.  
  21. path = Pragma('D','')
  22. Call extend_path
  23.  
  24. /*** I wanna talk to ya :) ***/
  25. Address 'KATANA'
  26.  
  27.  
  28. /*** Retrieve the arguments from the command line ***/
  29. Parse Arg source packer
  30.  
  31. If source = "" Then Do
  32.    Say "You must supply a source file, or use "?" for a file requester."
  33.    Exit 10
  34. End
  35.  
  36.  
  37. /*** Tell XPKatana what is the source file. ***/
  38.   SETSOURCE source ; found = result
  39.  
  40. /*****
  41.      If XPKatana can't find it, then try again, but adding the
  42.      current process's full path.
  43. *****/
  44.   IF (found = 'NOFILE') & (source ~= '?') Then SETSOURCE path||source
  45.  
  46.  
  47.  
  48. /*** Store the current packer, packmode and NoProgress. ***/
  49.   GETMODEINFO 1 ; oldmode = result
  50.   GETLIBINFO  1 ; oldpacker = result
  51.   GETFLAG NOPROGRESS ; oldprogress = result
  52.  
  53. /***** 
  54.    If there's a specified packer, use it.  If not, the 
  55.    current one will be used instead.
  56. *****/
  57.   If packer ~= "" Then Do
  58.      SETPACKER packer oldmode ; error = result
  59.      If error = "BADPACKER" Then Do
  60.         Say 'Invalid packer!'
  61.         Exit 10
  62.      End
  63.   End
  64.  
  65. /*** Set XPKatana to "No progress window". ***/
  66.   SETFLAGS NOPROGRESS 1
  67.  
  68. /*****
  69.    Pack the file, keeping the same filename (unless 
  70.    "Handle Suffix" was previously enabled 
  71. *****/
  72.   Say "Packing..."
  73.   PACK ; error = result
  74.  
  75.   If error = "ABORT" Then Do
  76.      Say "Packing aborted or failed!" 
  77.    End
  78.    Else Do
  79. /*** Examine the packed file to retrieve the ratio. ***/
  80.     EXAMINE ; e_string = result
  81.     Parse Var e_string e_filename e_packer e_encrypted e_ratio e_description
  82.     Say "Packed with "||e_packer||" (Gain: "||e_ratio||"%)."
  83.   End
  84.  
  85.  
  86.  
  87. /*** Restore the settings, and exit. ***/
  88.   SETPACKER oldpacker oldmode
  89.   SETFLAGS NOPROGRESS oldprogress
  90.  
  91. Exit
  92.  
  93. extend_path:
  94.    If Right(path,1) ~= ':' Then path = path||'/'
  95. Return
  96.  
  97.  
  98.